#include<stdio.h>
int main()
{
	double a, b, c, d, y, x;
	scanf_s("%lf%lf%lf%lf%lf", &x, &a, &b, &c, &d);
	y = a * x * x * x + b * x * x + c * x + d;
	printf("%.7lf", y);
	return 0;
}